/*
 * Copyright (c) 2019, Beijing Yonyou Audit Software. All rights reserved.
 *
 */
package publish;

/**
 * @author 若雨成霜
 * @description
 */
public class TestMain {
    public static void main(String[] args) {
        SubscriberPublish<String> subscribePublish = new SubscriberPublish<>("订阅器");
        IPublisher<String> publisher1 = new PublisherOne<>("发布者1");
        ISubscriberPublish<String> subscriberPublish1 = new SubscriberImpOne<>("订阅者1");
        ISubscriberPublish<String> subscriberPublish2 = new SubscriberImpOne<>("订阅者2");
        ISubscriberPublish<String> subscriberPublish3 = new SubscriberImpOne<>("订阅者3");
        ISubscriberPublish<String> subscriberPublish4 = new SubscriberImpOne<>("订阅者4");
        ISubscriberPublish<String> subscriberPublish5 = new SubscriberImpOne<>("订阅者5");
        ISubscriberPublish<String> subscriberPublish6 = new SubscriberImpOne<>("订阅者6");
        subscriberPublish1.subscribe(subscribePublish);
        subscriberPublish2.subscribe(subscribePublish);
        subscriberPublish3.subscribe(subscribePublish);
        subscriberPublish4.subscribe(subscribePublish);
        subscriberPublish5.subscribe(subscribePublish);
        subscriberPublish6.subscribe(subscribePublish);
        publisher1.publish(subscribePublish, "welcome", true);
        subscriberPublish1.unSubscribe(subscribePublish);
        publisher1.publish(subscribePublish, "啥哈哈", true);
    }
}
